package com.ys.extend;

import java.util.HashMap;
import java.util.Map;

/**
 * 导入数据的状态记录
 * @author wdj
 *
 */
public class ImportStateRecord {

	/**导入数据的状态*/
	private static final Map<String, String> stateMsgMap  = new HashMap<>();

	/**
	 * 通过用户名获取状态信息
	 * @param username
	 */
	public static String getStateMsg(String username){
		System.out.println(stateMsgMap.get(username));
		return stateMsgMap.get(username);
	}
	
	/**
	 * 添加状态
	 * @param username
	 * @param stateMsg
	 */
	public static void addStateMsg(String username, String stateMsg){
		if(!stateMsgMap.containsKey(username)){
			stateMsgMap.put(username, stateMsg);
		}
	}
	
	/**
	 * 更新状态
	 * @param username
	 * @param stateMsg
	 */
	public static void updateStateMsg(String username, String stateMsg){
		if(stateMsgMap.get(username) != null) {
			stateMsgMap.put(username, stateMsg);
		}
	}
	
	
	/**
	 * 删除状态
	 * @param username
	 */
	public static void removeStateMsg(String username){
		stateMsgMap.remove(username);
	}
	
}
